package com.onstar.cn.api;

import com.onstar.cn.api.framework.BaseApiService;
import com.onstar.cn.api.framework.ClazzInjectUtils;
import com.onstar.cn.api.framework.annotation.Path;
import com.onstar.cn.api.framework.annotation.PathParams;
import com.onstar.cn.api.framework.annotation.RequestMapping;
import com.onstar.cn.common.log.LogManager;
import com.onstar.cn.common.util.CommonUtil;
import com.onstar.cn.framework.network.entity.RequestEntity;
import com.onstar.cn.framework.utils.GsonHelper;
import com.onstar.cn.mag.LocalVehicleEntity;
import com.onstar.cn.mag.PlateEngineNumEntity;
import com.onstar.cn.mag.dealer.ReqAroundDealersEntity;
import com.onstar.cn.mag.joinme.RegisterRequestEntity;
import com.onstar.cn.more.request.DealersQueryRequest;
import com.onstar.cn.more.request.ProcessPreferredDealerRequest;

@Path("/msp/api/v3/user")
public class UsersService extends BaseApiService {

//	/msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/vehicle_image

//    /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/packages/paytype/{payType}/orders/{orderID}

    private String serverURL;

    /**
     * @Description: TODO
     * @author 6335yz
     * @date 2015年8月20日 下午3:36:47fghyhfg
     */
    public UsersService(String serverURL) {
        super(serverURL);
        this.serverURL = serverURL;
    }

    @RequestMapping("/authorization/create")
    public String test(@PathParams(value = "userId") String userId, @PathParams(value = "userIds") String userIds) {
        String url = ClazzInjectUtils.injectUrl(getClass(), "test", userId, userIds);
        return url;
    }

    @RequestMapping("/authorization/create")
    public RequestEntity create(RequestEntity entity) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "create", entity);
        entity.setUrl(serverURL + url);
        return entity;
    }

    @RequestMapping("/api/v1/account/vehicles/{vin}/data/services")
    public RequestEntity services(RequestEntity entity, @PathParams(value = "vin") String vin) {
//		entity.setBody(body);
        // /api/v1/account/vehicles/{vin}/data/services
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "services", entity, vin);
        entity.setUrl(serverURL + url);
        return entity;
    }

    /**
     * @param @param  entity
     * @param @param  ipPid
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: DeleteFavoriteDestination
     * @Description: 添加收藏
     */
    @RequestMapping("/{IDPID}/destination")
    public RequestEntity addFavoriteDestination(RequestEntity entity, @PathParams(value = "IDPID") String ipPid) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "addFavoriteDestination", entity, ipPid);
        entity.setUrl(serverURL + url);
        return entity;
    }

    /**
     * @param @param  entity
     * @param @param  ipPid
     * @param @param  favoriteDestinationID
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: deleteFavoriteDestination
     * @Description: 删除收藏
     */
    @RequestMapping("/{IDPID}/destination/{FavoriteDestinationID}")
    public RequestEntity deleteFavoriteDestination(RequestEntity entity, @PathParams(value = "IDPID") String ipPid, @PathParams(value = "FavoriteDestinationID") String favoriteDestinationID) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "deleteFavoriteDestination", entity, ipPid, favoriteDestinationID);
        entity.setUrl(serverURL + url);
        return entity;
    }

    /**
     * @param @param  entity
     * @param @param  ipPid
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: GetFavoriteDestinationList
     * @Description: 获取收藏列表
     */
    @RequestMapping("/{IDPID}/destination")
    public RequestEntity getFavoriteDestinationList(RequestEntity entity, @PathParams(value = "IDPID") String ipPid) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getFavoriteDestinationList", entity, ipPid);
        entity.setUrl(serverURL + url);
        return entity;
    }

    /**
     * @param @param  entity
     * @param @param  ipPid
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: SentToVehicleHistory
     * @Description: 获取TBT ODD历史记录
     */
    @RequestMapping("/{IDPID}/destination/stv_history")
    public RequestEntity getSentToVehicleHistory(RequestEntity entity, @PathParams(value = "IDPID") String ipPid) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getSentToVehicleHistory", entity, ipPid);
        entity.setUrl(serverURL + url);
        return entity;
    }

    /**
     * @param @param  entity
     * @param @param  subscriberID
     * @param @param  accountID
     * @param @param  vin
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getGeoFencings
     * @Description: 获取Geofence信息
     */
    @RequestMapping("/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/location/geo_fencing")
    public RequestEntity getGeoFencings(RequestEntity entity, @PathParams(value = "subscriberID") String subscriberID, @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getGeoFencings", entity, subscriberID, accountID, vin);
        entity.setUrl(serverURL + url);
        return entity;
    }

    /**
     * @param @param  entity
     * @param @param  subscriberID
     * @param @param  accountID
     * @param @param  vin
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getGeoFencings
     * @Description: 获取Geofence信息
     */
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/vehicle_image")
    public RequestEntity getVehicleImg(RequestEntity entity, @PathParams(value = "idpID") String ipdID, @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getVehicleImg", entity, ipdID, accountID, vin);
        entity.setUrl(serverURL + url);
        return entity;
    }

    //    /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/vehicle_image
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/vehicle_image")
    public RequestEntity saveVehicleImg(RequestEntity entity, @PathParams(value = "idpID") String ipdID, @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "saveVehicleImg", entity, ipdID, accountID, vin);
        entity.setUrl(serverURL + url);
        return entity;
    }
    //    /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/packages/paytype/{payType}/orders/{orderID}
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/packages/paytype/{payType}/orders/{orderID}")
    public RequestEntity payOrder(RequestEntity entity, @PathParams(value = "idpID") String ipdID,
                                  @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin,
                                  @PathParams(value = "payType") String payType,@PathParams(value = "orderID") String orderID) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "payOrder", entity, ipdID, accountID, vin,payType,orderID);
        entity.setUrl(serverURL + url);
        return entity;
    }

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/phevcharge")
    public RequestEntity getChargeState(RequestEntity entity, @PathParams(value = "idpID") String ipdID, @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getChargeState", entity, ipdID, accountID, vin);
        entity.setUrl(serverURL + url);
        return entity;
    }

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/phevcharge")
    public RequestEntity putChargeState(RequestEntity entity, @PathParams(value = "idpID") String ipdID, @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "putChargeState", entity, ipdID, accountID, vin);
        entity.setUrl(serverURL + url);
        return entity;
    }

    /**
     * @param @param  entity
     * @param @param  subscriberID
     * @param @param  accountID
     * @param @param  vin
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getGeoFencings
     * @Description: 获取Geofence信息
     */
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/vehicle_images")
    public RequestEntity getVehicleImgs(RequestEntity entity, @PathParams(value = "idpID") String ipdID, @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getVehicleImgs", entity, ipdID, accountID, vin);
        entity.setUrl(serverURL + url);
        return entity;
    }
//    /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/vehicle_images
//    /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/vehicle_image

    /**
     * @param @param  entity
     * @param @param  subscriberID
     * @param @param  accountID
     * @param @param  vin
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: processGeoFencing
     * @Description: 保存/删除/更新Geofencing
     */
    @RequestMapping("/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/location/geo_fencing")
    public RequestEntity processGeoFencing(RequestEntity entity, @PathParams(value = "subscriberID") String subscriberID, @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "processGeoFencing", entity, subscriberID, accountID, vin);
        entity.setUrl(serverURL + url);
        return entity;
    }


    /**
     * @param @param  entity
     * @param @param  subscriberID
     * @param @param  accountID
     * @param @param  vin
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: ActivatePrepaidCard
     * @Description: 预付卡验证/激活
     */
    @RequestMapping("/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/packages/prepaid_card")
    public RequestEntity activatePrepaidCard(RequestEntity entity, @PathParams(value = "subscriberID") String subscriberID, @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "activatePrepaidCard", entity, subscriberID, accountID, vin);
        entity.setUrl(serverURL + url);
        return entity;
    }

    /**
     * @param @param  requestEntity
     * @param @param  subscriberID
     * @param @param  accountID
     * @param @param  vin
     * @param @param  osType
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getHistory
     * @Description: 历史激活
     */
    @RequestMapping("/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/packages/prepaid_card/history")
    public RequestEntity getHistory(RequestEntity requestEntity, @PathParams(value = "subscriberID") String subscriberID,
                                    @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin, String osType) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getHistory", requestEntity, subscriberID, accountID, vin, osType);
        requestEntity.setUrl(serverURL + url + "?OSType=" + osType);
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: shareDestination
     * @Description: 短信分享
     */
    @RequestMapping("/destination/social")
    public RequestEntity shareDestination(RequestEntity requestEntity) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "shareDestination", requestEntity);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @param  andPhoneEntity
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getPhoneAndnumber
     * @Description:手机and邮箱
     */
    @RequestMapping("/register/subscriber/contact")
    public RequestEntity getPhoneAndnumber(RequestEntity requestEntity, RegisterRequestEntity userEntity) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getPhoneAndnumber", requestEntity, userEntity);
        String fullUrl = serverURL + url;
        //验证唯一性，将V1接口改为V2
//        if(!TextUtils.isEmpty(fullUrl) && fullUrl.contains("v1")){
//            fullUrl = fullUrl.replaceFirst("v1", "v2");
//        }
        requestEntity.setUrl(fullUrl);
//        requestEntity.setUrl(serverURL + url);
        requestEntity.setBody(GsonHelper.toJson(userEntity));
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @param  codeEntity
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getCode
     * @Description: 获取验证码
     */
    @RequestMapping("/register/code")
    public RequestEntity getCode(RequestEntity requestEntity, RegisterRequestEntity codeEntity) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getCode", requestEntity, codeEntity);
        requestEntity.setUrl(serverURL + url);
        requestEntity.setBody(GsonHelper.toJson(codeEntity));
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @param  codeEntity
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getCode
     * @Description: 获取验证码
     */
    @RequestMapping("/subscriber/{subscriberID}/code")
    public RequestEntity getCodeByLogining(RequestEntity requestEntity, @PathParams(value = "subscriberID") String idpid, RegisterRequestEntity codeEntity) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getCodeByLogining", requestEntity, idpid, codeEntity);
        requestEntity.setUrl(serverURL + url);
        requestEntity.setBody(GsonHelper.toJson(codeEntity));
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @param  idpid
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getAllVehicles
     * @Description:切换车辆
     */
    @RequestMapping("/subscriber/{IDPID}/accounts/vehicles")
    public RequestEntity getAllVehicles(RequestEntity requestEntity, @PathParams(value = "IDPID") String idpid) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getAllVehicles", requestEntity, idpid);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;

    }

    /**
     * @param @param  requestEntity
     * @param @param  codeEntity
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: checkCode
     * @Description: 验证验证码
     */
    @RequestMapping("/register/code/validation")
    public RequestEntity checkCode(RequestEntity requestEntity, RegisterRequestEntity codeEntity) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "checkCode", requestEntity, codeEntity);
        requestEntity.setUrl(serverURL + url);
        requestEntity.setBody(GsonHelper.toJson(codeEntity));
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @param  subscriberID
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: personal infomation
     * @Description: 个人账户
     */
    @RequestMapping("/subscriber/basic_info")
    public RequestEntity getPersonal(RequestEntity requestEntity) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getPersonal", requestEntity);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @param  subscriberID
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: personal infomation
     * @Description: 上传头像
     */
    @RequestMapping("/subscriber/headphoto")
    public RequestEntity uploadHeadPhoto(RequestEntity requestEntity) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "uploadHeadPhoto", requestEntity);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }


    /**
     * @param @param  requestEntity
     * @param @param  subscriberID
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: personal infomation
     * @Description: 获取头像地址
     */
    @RequestMapping("/subscriber/headphoto")
    public RequestEntity getHeadPhoto(RequestEntity requestEntity, String ipdID) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getHeadPhoto", requestEntity, ipdID);
        requestEntity.setUrl(serverURL + url + "?idpID=" + ipdID);
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @param  subscriberID
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getAccountInfoByVin
     * @Description: 通过VIN号获取用户信息
     */
    @RequestMapping("/subscriber/account")
    public RequestEntity getAccountInfoByVin(RequestEntity requestEntity, String vin) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getAccountInfoByVin", requestEntity, vin);
        requestEntity.setUrl(serverURL + url + "?vin=" + vin);
        return requestEntity;
    }

    @RequestMapping("/profile")
    public RequestEntity getUserProfile(RequestEntity requestEntity, String body) {
        return getURLRequestEntity("getUserProfile", body, requestEntity, body);
//        if (requestEntity == null) {
//            requestEntity = new RequestEntity();
//        }
//        String url = ClazzInjectUtils.injectUrl(getClass(), "getUserProfile", requestEntity, body);
//        if (!CommonUtil.isNull(body)) {
//            requestEntity.setBody(body);
//        }
//        requestEntity.setUrl(serverURL + url);
//        return requestEntity;
    }

    @RequestMapping("/info3/profile")
    public RequestEntity getUserInfo3Profile(RequestEntity requestEntity, String body) {
        return getURLRequestEntity("getUserInfo3Profile", body, requestEntity, body);
//        if (requestEntity == null) {
//            requestEntity = new RequestEntity();
//        }
//        String url = ClazzInjectUtils.injectUrl(getClass(), "getUserProfile", requestEntity, body);
//        if (!CommonUtil.isNull(body)) {
//            requestEntity.setBody(body);
//        }
//        requestEntity.setUrl(serverURL + url);
//        return requestEntity;

    }

    /**
     * @param @param  requestEntity
     * @param @param  subscriberID
     * @param @param  accountID
     * @param @param  vin
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getCityDealer
     * @Description: get city dealer
     */
    @RequestMapping("/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/dealers/city")
    public RequestEntity getCityDealer(RequestEntity requestEntity, DealersQueryRequest dealersQueryRequest, @PathParams(value = "subscriberID") String subscriberID, @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin, Integer pageNumber, Integer pageSize) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getCityDealer", requestEntity, dealersQueryRequest, subscriberID, accountID, vin, pageNumber, pageSize);
        requestEntity.setUrl(serverURL + url + "?pageNumber=" + (pageNumber <= 0 ? 0 : pageNumber) + "&pageSize=" + (pageSize <= 0 ? 10 : pageSize));
        requestEntity.setBody(GsonHelper.toJson(dealersQueryRequest));
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getProcessDealer
     * @Description: 保存经销商
     */
    @RequestMapping("/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/dealers/prefer")
    public RequestEntity getProcessDealer(RequestEntity requestEntity, ProcessPreferredDealerRequest preferredDealerRequest, @PathParams(value = "subscriberID") String subscriberID, @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getProcessDealer", requestEntity, preferredDealerRequest, subscriberID, accountID, vin);
        requestEntity.setUrl(serverURL + url);
        requestEntity.setBody(GsonHelper.toJson(preferredDealerRequest));
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getVehicles
     * @Description: 获取车辆列表
     */
    @RequestMapping("/subscriber/{subscriberID}/accounts/vehicles")
    public RequestEntity getVehicles(RequestEntity requestEntity, @PathParams(value = "subscriberID") String subscriberID) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getVehicles", requestEntity, subscriberID);
        requestEntity.setUrl(serverURL + url);
//		requestEntity.setBody(GsonHelper.toJson(preferredDealerRequest));
        return requestEntity;
    }

    /**
     * @param @param  requestEntity
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: swichVehicle
     * @Description: 切换车辆
     */
    @RequestMapping("/subscriber/{subscriberID}/accounts/vehicles/swich")
    public RequestEntity swichVehicle(RequestEntity requestEntity, @PathParams(value = "subscriberID") String subscriberID, String accountID, String vin) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "swichVehicle", requestEntity, subscriberID, accountID, vin);
        requestEntity.setUrl(serverURL + url + "?account_id=" + accountID + "&vin=" + vin);
        return requestEntity;
    }

    @RequestMapping("/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/dealers/around")
    public RequestEntity getAroundDealersService(RequestEntity entity, @PathParams("subscriberID") String subscriberID,
                                                 @PathParams("accountID") String accountID, @PathParams("vin") String vin,
                                                 ReqAroundDealersEntity ReqAroundDealers) {
        if (entity == null) {
            entity = new RequestEntity();
        }

        String url = ClazzInjectUtils.injectUrl(getClass(), "getAroundDealersService", entity, subscriberID, accountID, vin, ReqAroundDealers);
        entity.setBody(GsonHelper.toJson(ReqAroundDealers));
        entity.setUrl(serverURL + url);
        return entity;
    }

    /**
     * @param @param  requestEntity
     * @param @return 设定文件
     * @return RequestEntity    返回类型
     * @throws
     * @Title: getVehicleInfo
     * @Description: 获取发动机车牌号
     */
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/info")
    public RequestEntity getVehicleInfo(@PathParams(value = "idpID") String idpID,
                                        @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
        RequestEntity requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "getVehicleInfo", idpID, accountID, vin);
        LogManager.getInstance().d("getVehicleInfo url=" + url);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/info")
    public RequestEntity putVehicleInfo(PlateEngineNumEntity entity, @PathParams(value = "idpID") String idpID,
                                        @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
        RequestEntity requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "putVehicleInfo", entity, idpID, accountID, vin);
        LogManager.getInstance().d("putVehicleInfo url=" + url);
        requestEntity.setUrl(serverURL + url);
        requestEntity.setBody(GsonHelper.toJson(entity));
        return requestEntity;
    }

//    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/local/service")
//    public RequestEntity localVehicleService(LocalVehicleEntity entity, @PathParams(value = "idpID") String idpID,
//                                             @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
//        RequestEntity requestEntity = new RequestEntity();
//        String url = ClazzInjectUtils.injectUrl(getClass(), "localVehicleService", entity, idpID, accountID, vin);
//        LogManager.getInstance().d("localVehicleService url=" + url);
//        requestEntity.setUrl(serverURL + url);
//        requestEntity.setBody(GsonHelper.object2Json(entity, false));
//        return requestEntity;
//    }

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/footprint/summary")
    public RequestEntity getFootPrintSummary(RequestEntity requestEntity, @PathParams(value = "idpID") String idpID,
                                             @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getFootPrintSummary", requestEntity, idpID, accountID, vin);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/footprint/city")
    public RequestEntity getFootPrintByCity(RequestEntity requestEntity, @PathParams(value = "idpID") String idpID,
                                            @PathParams("accountID") String accountID, @PathParams("vin") String vin, String city) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getFootPrintByCity", requestEntity, idpID, accountID, vin,city);
        requestEntity.setUrl(serverURL + url + "?city=" + city);
        return requestEntity;
    }

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/footprint/{footprintid}")
    public RequestEntity deleteFootPrint(RequestEntity requestEntity, @PathParams(value = "idpID") String idpID,
                                         @PathParams("accountID") String accountID, @PathParams("vin") String vin, @PathParams("footprintid") String footprintid) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "deleteFootPrint", requestEntity, idpID, accountID, vin, footprintid);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smartdrive/getdrivingscore")
    public RequestEntity getDrivingScore(RequestEntity requestEntity, @PathParams(value = "idpID") String idpID, @PathParams("vin") String vin,@PathParams("accountID") String accountID) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getDrivingScore", requestEntity, idpID, vin,accountID);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/local/service")
    public RequestEntity localVehicleService(LocalVehicleEntity entity, @PathParams(value = "idpID") String idpID,
                                             @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
        RequestEntity requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "localVehicleService", entity, idpID, accountID, vin);
        LogManager.getInstance().d("localVehicleService url=" + url);
        requestEntity.setUrl(serverURL + url);
        requestEntity.setBody(GsonHelper.toJson(entity));
        return requestEntity;
    }
//    /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome/devices

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome/devices")
    public RequestEntity getSmartDevices(@PathParams(value = "idpID") String idpID,
                                         @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
        RequestEntity requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "getSmartDevices", idpID, accountID, vin);
        LogManager.getInstance().d("getSmartDevices url=" + url);
        requestEntity.setUrl(serverURL + url+"?platform=MIEDA");
        return requestEntity;
    }

//    /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome /devices/{deviceID}

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome/devices/{deviceID}")
    public RequestEntity getSmartDeviceDetail(@PathParams(value = "idpID") String idpID,
                                              @PathParams("accountID") String accountID, @PathParams("vin") String vin,@PathParams("deviceID") String deviceID,String deviceType) {
        RequestEntity requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "getSmartDeviceDetail",idpID, accountID, vin,deviceID,deviceType);
        LogManager.getInstance().d("getSmartDeviceDetail url=" + url);
        requestEntity.setUrl(serverURL + url+"?deviceType="+deviceType+"&platform=MIDEA");
        return requestEntity;
    }
    //    URL/msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome /control/{deviceID}
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome/control")
    public RequestEntity controlSmartDevice( RequestEntity requestEntity,@PathParams(value = "idpID") String idpID,
                                             @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "controlSmartDevice",requestEntity,idpID, accountID, vin);
        LogManager.getInstance().d("controlSmartDevice url=" + url);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

    //    /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome / geofencing/{deviceID}
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome/geofencing/{deviceID}")
    public RequestEntity saveSmartGeoFencing(RequestEntity requestEntity,@PathParams(value = "idpID") String idpID,
                                             @PathParams("accountID") String accountID, @PathParams("vin") String vin,@PathParams("deviceID") String deviceID) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "saveSmartGeoFencing",requestEntity,idpID, accountID, vin,deviceID);
        LogManager.getInstance().d("saveSmartGeoFencing url=" + url);
        requestEntity.setUrl(serverURL + url+"?platform=MIDEA");
        return requestEntity;
    }
    //   /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome / geofencing/batch
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome/geofencing/batch")
    public RequestEntity batchApplySmartDeviceGeofencing(RequestEntity requestEntity,@PathParams(value = "idpID") String idpID,
                                                         @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "batchApplySmartDeviceGeofencing",requestEntity,idpID, accountID, vin);
        LogManager.getInstance().d("batchApplySmartDeviceGeofencing url=" + url);
        requestEntity.setUrl(serverURL + url+"?platform=MIDEA");
        return requestEntity;
    }

    //    /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome/bind
//    /msp/api/v3/user/subscriber/ONSTARM123456/accounts/123456/vehicles/LSG4567890/smarthome/bind?deviceId=17592186044620&platform=MIDEA
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome/bind")
    public RequestEntity bindDevice(@PathParams(value = "idpID") String idpID,
                                    @PathParams("accountID") String accountID, @PathParams("vin") String vin,String deviceID) {
        RequestEntity requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "bindDevice",idpID, accountID, vin,deviceID);
        LogManager.getInstance().d("getSmartDeviceDetail url=" + url);
        requestEntity.setUrl(serverURL + url+"?deviceId="+deviceID+"&platform=MIDEA");//
        return requestEntity;
    }
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome/unbind")
    public RequestEntity unBindDevice(@PathParams(value = "idpID") String idpID,
                                      @PathParams("accountID") String accountID, @PathParams("vin") String vin,String deviceID) {
        RequestEntity requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "unBindDevice",idpID, accountID, vin,deviceID);
        LogManager.getInstance().d("getSmartDeviceDetail url=" + url);
        requestEntity.setUrl(serverURL + url+"?deviceId="+deviceID+"&platform=MIDEA");
        return requestEntity;
    }
//    /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/local/services

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/local/services")
    public RequestEntity getServiceStatus(RequestEntity requestEntity,@PathParams(value = "idpID") String idpID,
                                          @PathParams("accountID") String accountID, @PathParams("vin") String vin,String serviceName) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "getServiceStatus",requestEntity,idpID, accountID, vin,serviceName);
        LogManager.getInstance().d("getSmartDeviceDetail url=" + url);
        requestEntity.setUrl(serverURL + url+"?serviceName="+serviceName);
        return requestEntity;
    }

    // 驾驶评分评价开启
    @RequestMapping("/subscriber/{IDPID}/accounts/{accountID}/vehicles/{vin}/local/service")
    public RequestEntity optInService(RequestEntity requestEntity, @PathParams(value = "IDPID") String IDPID,
                                    @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin,String body) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "optInService",requestEntity,IDPID, accountID, vin,body);
        LogManager.getInstance().d("getSmartDeviceDetail url=" + url + ",body == " + body);
        requestEntity.setUrl(serverURL + url);
        if (!CommonUtil.isNull(body))
            requestEntity.setBody(body);
        return requestEntity;
    }
    // 驾驶评分评价关闭
    @RequestMapping("/subscriber/{IDPID}/accounts/{accountID}/vehicles/{vin}/local/service/{serviceName}")
    public RequestEntity optOutService(RequestEntity requestEntity, @PathParams(value = "IDPID") String IDPID,
                                    @PathParams(value = "accountID") String accountID, @PathParams(value = "vin") String vin,@PathParams(value = "serviceName") String serviceName) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "optOutService",requestEntity,IDPID, accountID, vin,serviceName);
        LogManager.getInstance().d("getSmartDeviceDetail url=" + url );
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/smarthome/token")
    public RequestEntity getToken( RequestEntity requestEntity,@PathParams(value = "idpID") String idpID,
                                   @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "getToken",requestEntity,idpID, accountID, vin);
        LogManager.getInstance().d("controlSmartDevice url=" + url);
        requestEntity.setUrl(serverURL + url+"?platform=MIDEA");
        return requestEntity;
    }
//    msp/api/v3/user/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/notifypreference
    //获取提醒设置
    @RequestMapping("/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/notifypreference")
    public RequestEntity getNotifyPreference( RequestEntity requestEntity,@PathParams(value = "subscriberID") String subscriberID,
                                   @PathParams("accountID") String accountID, @PathParams("vin") String vin,String type) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "getNotifyPreference",requestEntity,subscriberID, accountID, vin,type);
        LogManager.getInstance().d("controlSmartDevice url=" + url);
        requestEntity.setUrl(serverURL + url+"?btype="+type);
        return requestEntity;
    }


//   msp/api/v3/ user/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/notifypreference
    //设置提醒设置s
    @RequestMapping("/subscriber/{subscriberID}/accounts/{accountID}/vehicles/{vin}/notifypreference")
    public RequestEntity setNotifyPreference( RequestEntity requestEntity,@PathParams(value = "subscriberID") String subscriberID,
                                   @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "setNotifyPreference",requestEntity,subscriberID, accountID, vin);
        LogManager.getInstance().d("controlSmartDevice url=" + url);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }
//   msp/api/v3/user/subscriber/{idpId}/accounts/{accountID}/vehicles/{vin}/validateNotifyConfig
    //检测微信
    @RequestMapping("/subscriber/{idpId}/accounts/{accountID}/vehicles/{vin}/validateNotifyConfig")
    public RequestEntity checkNotifyPreference( RequestEntity requestEntity,@PathParams(value = "idpId") String idpId,
                                   @PathParams("accountID") String accountID, @PathParams("vin") String vin) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "checkNotifyPreference",requestEntity,idpId, accountID, vin);
        LogManager.getInstance().d("controlSmartDevice url=" + url);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }
//  msp/api/v3/user/subscriber/{subscriberID}/notifypreference/code
    //发送验证码
    @RequestMapping("/subscriber/{subscriberID}/notifypreference/code")
    public RequestEntity getNotifyCode( RequestEntity requestEntity,@PathParams(value = "subscriberID") String subscriberID) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "getNotifyCode",requestEntity,subscriberID);
        LogManager.getInstance().d("controlSmartDevice url=" + url);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }
//  msp/api/v3/user/subscriber/{subscriberID}/notifypreference/validation
    //检验验证码
    @RequestMapping("/subscriber/{subscriberID}/notifypreference/validation")
    public RequestEntity validateNotifyCode( RequestEntity requestEntity,@PathParams(value = "subscriberID") String subscriberID) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "validateNotifyCode",requestEntity,subscriberID);
        LogManager.getInstance().d("controlSmartDevice url=" + url);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

    // info3补充用户信息:http://113.52.176.197:51611/mspV3/api/v3/user/register/info3/update
    @RequestMapping("/register/info3/update")
    public RequestEntity doReplenish(RequestEntity requestEntity,String body) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "doReplenish",requestEntity,body);
        LogManager.getInstance().d("doReplenish url=" + url );
        requestEntity.setUrl(serverURL + url);
        if (!CommonUtil.isNull(body))
            requestEntity.setBody(body);
        return requestEntity;
    }

    /**
     * info3是否需要补充用户姓名
     * @param requestEntity
     * @param idpID
     * @param vin
     * @return
     */
    @RequestMapping("/subscriber/{idpID}/accounts/vehicles/{vin}/validateNeedName")
    public RequestEntity validateNeedName( RequestEntity requestEntity,@PathParams(value = "idpID") String idpID, @PathParams("vin") String vin) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "validateNeedName",requestEntity,idpID, vin);
        LogManager.getInstance().d("validateNeedName url=" + url);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

//    /api/v3/user/subscriber/{subscriberId}/accounts/{accountId}/vehicles/{vin}/carSharing/authorizedsubs
    @RequestMapping("/subscriber/{subscriberId}/accounts/{accountId}/vehicles/{vin}/carSharing/authorizedsubs")
    public RequestEntity getAuthorizedSubs( RequestEntity requestEntity,@PathParams(value = "subscriberId") String subscriberId,
                                           @PathParams("accountId") String accountId, @PathParams("vin") String vin) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "getAuthorizedSubs",requestEntity,subscriberId,accountId,vin);
        LogManager.getInstance().d("validateNeedName url=" + url);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }
//    /api/v3/user/subscriber/{subscriberId}/accounts/{accountId}/vehicles/{vin}/carSharing/status
    @RequestMapping("/subscriber/{subscriberId}/accounts/{accountId}/vehicles/{vin}/carSharing/status")
    public RequestEntity getSharingStatus( RequestEntity requestEntity,@PathParams(value = "subscriberId") String subscriberId,
                                           @PathParams("accountId") String accountId, @PathParams("vin") String vin) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "getSharingStatus",requestEntity,subscriberId,accountId,vin);
        LogManager.getInstance().d("validateNeedName url=" + url);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

//    /api/v3/user/subscriber/{subscriberId}/accounts/{accountId}/vehicles/{vin}/carSharing/authorization
    @RequestMapping("/subscriber/{subscriberId}/accounts/{accountId}/vehicles/{vin}/carSharing/authorization")
    public RequestEntity putSharingAuthorization( RequestEntity requestEntity,@PathParams(value = "subscriberId") String subscriberId,
                                           @PathParams("accountId") String accountId, @PathParams("vin") String vin) {
        if(requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(), "putSharingAuthorization",requestEntity,subscriberId,accountId,vin);
        LogManager.getInstance().d("validateNeedName url=" + url);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }
}
